'''
F分布
概率密度函数图像
'''

import math
import numpy as np
from scipy.stats import norm
from scipy.stats import f
import matplotlib.pyplot as plt
from pylab import mpl
plt.style.use('seaborn-darkgrid')
mpl.rcParams['font.sans-serif'] = ['SimHei']  # 显示中文字体
plt.rcParams['axes.unicode_minus'] = False  # 显示负号

lst = []
cnt = 0
for i in range(46):
    cnt = round(cnt + 0.1, 2)
    lst.append(cnt)

x = lst
plt.plot(x, f.pdf(x, 20, 20), "k-", label='y = f(x,20,20）')
plt.plot(x, f.pdf(x, 10, 10), "b--", label='y = f(x,10,10）')
plt.plot(x, f.pdf(x, 10, 5), "r-", label='y = f(x,10,5）')
plt.plot(x, f.pdf(x, 10, 50), "g--", label='y = f(x,10,50）')
plt.plot(x, f.pdf(x, 80, 80), "y-", label='y = f(x,80,80）')

plt.xlabel('x', fontsize=12)
plt.ylabel('f(x)', fontsize=12)
plt.legend(loc=1)
plt.title("F分布——不同自由度的概率密度函数")
plt.show()